FROM 101.35.1.79/ruyuan-order-system/centos7-jdk:v1

WORKDIR /java

ARG JAR_FILE="target/ruyuan-eshop-fulfill-service.jar"
ARG APP_NAME="ruyuan-eshop-fulfill-service"
ARG DEFAULT_APP_ACTIVE_PROFILE

#ARG SKYWALKING_SERVER_ADDR
#ARG DEFAULT_CONFIG_SERVER_ADDR

COPY ${JAR_FILE} /java/app.jar

ENV TZ="Asia/Shanghai"
ENV JVM_OPTS="-server \
-Xms512m \
-Xmx512m \
-Xss512k \
-XX:MetaspaceSize=256m \
-XX:NewRatio=2 \
-XX:+PrintTenuringDistribution \
-XX:+PrintHeapAtGC \
-XX:+UseConcMarkSweepGC \
-XX:+UseParNewGC  \
-XX:+UseCMSCompactAtFullCollection  \
-XX:CMSFullGCsBeforeCompaction=5 \
-XX:CMSInitiatingOccupancyFraction=70 \
-XX:+CMSClassUnloadingEnabled \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-Xloggc:/java/gc-%t-%p.log \
-XX:+HeapDumpBeforeFullGC \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/java \
-XX:+PrintClassHistogramBeforeFullGC \
-XX:+PrintClassHistogramAfterFullGC \
-XX:ErrorFile=/java/hs_err_pid%p.log"

#ENV JAVA_TOOL_OPTIONS="-javaagent:/java/agent/skywalking-agent.jar \
#-Dskywalking.collector.backend_service=${SKYWALKING_SERVER_ADDR} \
#-Dskywalking.agent.service_name=${APP_NAME} \
#-Dskywalking.trace.ignore_path=/actuator/**"

ENV APP_ACTIVE_PROFILE=${DEFAULT_APP_ACTIVE_PROFILE}
#ENV CONFIG_SERVER_ADDR=${DEFAULT_CONFIG_SERVER_ADDR}

ENTRYPOINT exec java $JVM_OPTS -Dspring.profiles.active=$APP_ACTIVE_PROFILE -jar /java/app.jar
